package borge.web.teamspirit.client.servercomm;

import java.io.Serializable;
import java.util.List;

import borge.web.teamspirit.client.data.Person;
import borge.web.teamspirit.client.interfaces.PersistentData;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * The async counterpart of <code>GreetingService</code>.
 */
public interface DataServiceAsync {

	//void saveSerie(Serie aSerie, AsyncCallback<Boolean> callback);
//	void savePlayer(TeamPlayer aPlayer, AsyncCallback<DBQueryResult<TeamPlayer>> callback);
//	void saveSerie(Serie aSerie, AsyncCallback<DBQueryResult<Serie>> callback);
//	void saveMatch(Match aMatch, AsyncCallback<DBQueryResult<Match>> callback);
//	void saveNews(News aNews, AsyncCallback<DBQueryResult<News>> callback);
//	void saveEvent(Event aEvent, AsyncCallback<DBQueryResult<Event>> callback);
//	
//	void deletePlayer(TeamPlayer aPlayer, AsyncCallback<DBQueryResult<TeamPlayer>> callback);
//	void deleteSerie(Serie aSerie, AsyncCallback<DBQueryResult<Serie>> callback);
//	void deleteMatch(Match aMatch, AsyncCallback<DBQueryResult<Match>> callback);
//	void deleteNews(News aNews, AsyncCallback<DBQueryResult<News>> callback);
//	void deleteEvent(Event aEvent, AsyncCallback<DBQueryResult<Event>> callback);
//	
	<T extends Serializable> void getSessionValue(String aKey, AsyncCallback<T> callback);
	
	void isFieldUnique(DBQuery aQuery, AsyncCallback<DBQueryResults> callback);
	
	void loginUser(String aUserName, String aPassword, AsyncCallback<DBQueryResults> callback);
	void destroyUserSession(String aId, AsyncCallback<DBQueryResults> callback);
	void isSessionValid(String aId, AsyncCallback<DBQueryResults> callback);
	
	//void getPlayerList(DBQuery aQuery, AsyncCallback<DBQueryResult<TeamPlayer>> callback);
	
	<T extends Serializable> void genericQuery(DBQuery aQuery, AsyncCallback<DBQueryResults> callback);
	
	<T extends PersistentData> void saveObject(T aObject, AsyncCallback<DBQueryResults> callback);
	<T extends PersistentData> void deleteObject(DBQuery aQuery, AsyncCallback<DBQueryResults> callback);
	void getObjectList(DBQuery aQuery, AsyncCallback<DBQueryResults> callback);
	void getObjectChildren(List<DBQuery> aQueries, AsyncCallback<DBQueryResults> callback);

	void getAllSerieData(DBQuery aQuery, AsyncCallback<DBQueryResults> callback);
	void getSerieStats(DBQuery aQuery, AsyncCallback<DBQueryResults> callback);
	void getAllSeriesStats(List<DBQuery> aQueries, AsyncCallback<DBQueryResults> callback);
	
	void testCreateEntities(AsyncCallback callback);
	void testPrintEntities(AsyncCallback callback);
}

